<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!Doctype html>
<html>
<head>
    <meta content="text/html" charset="utf-8">
    <title>党建</title>
    <meta name="keywords" content="务川,党建"/>
    <meta name="description" content="务川,党建"/>
    <link href="../../static/images/ico/favicon.png" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="../../static/css/article.css">
    <link rel="stylesheet" type="text/css" href="../../static/css/bootstrap.css">

    <script type="text/javascript" src="../../static/js/user/jq181.js"></script>
    <script type="text/javascript" src="../../static/js/user/article.js"></script>
    <script type="text/javascript" src="../../static/js/bootstrap.js"></script>
    <style>
        .myBorder{
            background-color: #fff;
            border: 1px solid #ddd;
            display: block;
            line-height: 1.42857;
            margin-bottom: 20px;
            padding: 4px;
            transition: all 0.2s ease-in-out 0s;
            text-align: center;
            border-radius: 6px;
            font-size: 16px;
        }
        .myBorder button{
            font-size: 18px;
        }
    </style>
    <script>

        var currUrl = "/exam/startCurrTest.do";
        var examUrl = "/exam/startExamTest.do";
        var data = {
            model:"",//curr exam 考试模块，课程的考试还是自建考试
            id:""
        }

        function queRen(id,model)
        {
            data.id = id;
            data.model = model;
            $("#myModal").modal('show');
        }

        function startTest(){
            if(data.model =="curr")
            {
                location.href = currUrl+"?id="+data.id;
            }
            else if(data.model == "exam")
            {
                location.href = examUrl+"?id="+data.id;
            }
        }
    </script>
</head>
<body>
<jsp:include page="../../themes/header.jsp"/>
<div id="middle">
    <div class="wrapper">
        <div id="middle-content">
            <div class="article-wrapper">
                <div class="article-header">
                    <div>
                        <span></span>当前位置：<a href="/">首页</a> &gt; <a href="/learning/curriculumList.do">学习考试</a> &gt; <a href="/news/testList.do">考试列表</a>
                    </div>
                </div>
                <div class="article-content-wrapper" style="padding-top: 10px;">
                    <c:if test="${fn:length(currList)==0 && fn:length(examList)==0}">
                        <div class="alert alert-success" role="alert"><strong>没有需要进行的考试。</strong></div>
                    </c:if>
                    <c:forEach var="item" items="${currList}" varStatus="status">
                        <c:if test="${status.index % 4==0}">
                            <div class="row">
                        </c:if>
                            <div class="col-xs-3">
                                <div class="myBorder">
                                    <button onclick="queRen(${item.id},'curr')" class="btn btn-block">
                                        ${item.title}&nbsp;的考试
                                    </button>
                                    <p></p>
                                </div>
                            </div>
                        <c:if test="${(status.index+1) % 4==0 || (fn:length(currList) == (status.index+1))}">
                            </div>
                        </c:if>
                    </c:forEach>
                    <c:forEach var="item" items="${examList}" varStatus="status">
                        <c:if test="${status.index % 4==0}">
                            <div class="row">
                        </c:if>
                        <div class="col-xs-3">
                            <div class="myBorder">
                                <button onclick="queRen(${item.id},'exam')" class="btn btn-block">
                                        ${item.name}
                                </button>
                                <p></p>
                            </div>
                        </div>
                        <c:if test="${(status.index+1) % 4==0 || (fn:length(examList) == (status.index+1))}">
                        </div>
                        </c:if>
                    </c:forEach>
                    </div>
            </div>
        </div>
    </div>
</div>
<div id="myModal" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-sm" style="margin-top: 150px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4>开始考试？</h4>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" onclick="startTest()" class="btn btn-primary">确定</button>
            </div>
        </div>
    </div>
</div>
<c:if test="${empty sessionScope.sysUser}">
    <script type="text/javascript">
        alert("亲爱的用户，请先登录");
        window.location.href="/loginReg/login.do";
    </script>
</c:if>
<jsp:include page="../../themes/footer.jsp"/>
</body>
</html>